package com.example.gty.controller;

import com.example.gty.entity.RolePremissionVo;
import com.example.gty.service.AdminsService;
import com.example.gty.utils.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admins")
@Api(tags = "权限管理")
public class AdminsController {
    @Autowired
    private AdminsService adminsService;

    @ApiOperation(value = "查询所有权限")
    @RequestMapping(value = "/selectAllPer",method = RequestMethod.GET)
    public List<RolePremissionVo> selectAllPer(){
      return adminsService.selectAllPer();
    }

    @ApiOperation(value = "按照id查询权限")
    @RequestMapping(value = "/selectPerById",method = RequestMethod.GET)
    public List<RolePremissionVo> selectAllPerById(String no){
        return adminsService.selectAllPerById(no);
    }

    @ApiOperation(value = "权限的添加与删除")
    @RequestMapping(value = "/updatePer",method = RequestMethod.GET)
    public ResultVo permissionConntroller(String no,String pers){
        return adminsService.permissionConntroller(no, pers);
    }

}
